package org.chnxi.study.concurrent.abc.demo;

/**
 * 使用 join实现
 */
public class Demo2 {

    public static void main(String[] args) {
        Thread ta = new Thread(()->{
            System.out.println("A");
        });

        Thread tb = new Thread(()->{
            try {
                //等待A线程执行完
                ta.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("B");
        });

        Thread tc = new Thread(()->{
            try {
                //等待B线程执行完
                tb.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("C");
        });

        tc.start();
        tb.start();
        ta.start();
    }

}
